package com.boss.oss.service.impl;

import com.boss.oss.dao.OssDao;
import com.boss.oss.service.OssService;
import java.io.File;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * 服务实现类
 * @author Hu_liantian
 * @date 2020/07/27
 */
@Service
public abstract class OssServiceImp implements OssService {

    @Autowired
    OssDao ossDao;

    /**
     * 上传/修改文件
     * @author Hu_liantian
     * @date 2020/07/27
     */
    @Override
    @Async("async")
    public void insertFile(File file){
        ossDao.insertFile(file);
    }

    /**
     * 删除文件
     * @author Hu_liantian
     * @date 2020/07/27
     */
    @Override
    @Async("async")
    public void removeFile(String fileName){
        ossDao.removeFile(fileName);
    }

    /**
     * 查询文件
     * @author Hu_liantian
     * @date 2020/07/27
     */
    @Override
    @Async("async")
    public List queryFile() {
        return ossDao.queryFile();
    }

    /**
     * 下载文件
     * @author Hu_liantian
     * @date 2020/07/27
     */
    @Override
    @Async("async")
    public void downloadFile(String fileName, File file){
        ossDao.downloadFile(fileName,file);
    }

    /**
     * 关闭
     * @author Hu_liantian
     * @date 2020/07/27
     */
    @Override
    @Async("async")
    public void shutdown() {
        ossDao.shutdown();
    }

}
